package cn.iocoder.yudao.module.product.controller.app.spu.vo;

import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class AppProductSkuRespPropertyVO extends AppProductSkuRespOptionVO {

    @Schema(description = "排序")
    private Integer sort;
    @Schema(description = "属性值列表")
    private List<AppProductSkuRespPropertyValueVO> values;

    public static AppProductSkuRespPropertyVO fromPropertyDO(ProductPropertyDO property) {
        AppProductSkuRespPropertyVO propertyVO = new AppProductSkuRespPropertyVO();
        propertyVO.setId(property.getId());
        propertyVO.setName(property.getName());
        propertyVO.setSort(property.getSort());
        propertyVO.setValues(new ArrayList<>());
        return propertyVO;
    }
}
